#include "CLocationDescriptor.h"


CLocationDescriptor::CLocationDescriptor(void):IDescriptorData(DESCRIPTOR_TAG_LOCATION)
, m_lLocationType(0)    	
, m_wXPos(0) 
, m_wYPos(0)
, m_wWidth(0)
, m_wHeight(0)
, m_ucTransparency(0xFF)
, m_bStoreFlag(0)
{	
}

CLocationDescriptor::~CLocationDescriptor(void)
{
}

void CLocationDescriptor::GetData(BYTE* buff  , int &len)
{
	CBuffer stBuffer(buff, DESCRIPTOR_MAXLEN);

	PACK_DESCRIPTOR_BUFFER_START(stBuffer, DESCRIPTOR_TAG_LOCATION);

	stBuffer.Write((WORD)m_wXPos);
	stBuffer.Write((WORD)m_wYPos);
	stBuffer.Write((WORD)m_wWidth);
	stBuffer.Write((WORD)m_wHeight);
	stBuffer.Write((BYTE)m_ucTransparency);
	stBuffer.Write((BYTE)((m_bStoreFlag << 7) | 0x7F));
	stBuffer.Write(LOCATION_MASK(m_lLocationType));

	len = PACK_DESCRIPTOR_BUFFER_END(stBuffer);
}